Repository navigation
fix(obs-list): draw the Obs Lists picker with the shared menu layout (uses the full rev4 display) - #704
Merged
Conversation
On rev4 (176x176) the Obs Lists picker showed only 3 rows below a selection box that sat too high and stopped at x=129. UIObsList had its own copy of the pre-#453 UITextMenu drawing loop, with fixed 128-px row positions and a fixed selection box. Remove that loop. UITextMenu.update now draws each item through a small _draw_item_text() hook, and UIObsList overrides only that hook to scroll the selected item when it is too long. Rows, fonts, brightness and the selection box now come from carousel_layout(), as in every other menu. On 128x128 the rows move down 1-4 px, the same shift the other menus got in #453. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a rev4 unit, the observing-list screen (Objects → Obs Lists) now uses the whole display. It shows 9 lines, and the selection box is at the center of the screen.
Problem
On rev4 (the 176 × 176 display), the Obs Lists screen did not use all of the display:
Thus, the screen showed fewer observing lists than the unit had. The other menus on rev4 were correct.
Cause
UIObsList(ui/obs_list.py) had its own copy of the old menu drawing code. That code used fixed positions for the 128 × 128 display: 7 lines, and a selection box at(-1, 60, 129, 80). PR #453 changedUITextMenuto calculate the layout from the display, but it did not change this copy.Change
The Obs Lists screen now uses the same drawing code as all other menus.
UIObsListhas no drawing loop now.UITextMenu.update()draws the lines and the selection box withcarousel_layout().UITextMenuhas a new small method,_draw_item_text(). It draws the text of one item. A subclass can replace it to change how an item is drawn, but the subclass keeps the shared layout.UIObsListreplaces only_draw_item_text(). On the selected line, the name scrolls when it is too long. This was the only function that the old copy added.Lines of code:
obs_list.py+19 / −53,text_menu.py+17 / −3. A new test file,tests/test_obs_list_layout.py, has 6 tests at 128 and 176. The tests fail on the old code and pass on the new code.Screenshots
Before (left) and after (right), with 11 test lists and 1 folder.
rev4, 176 × 176:
(Screenshot to attach: rev4 before and after,
before_after_rev4_176.png.)v3, 128 × 128:
(Screenshot to attach: 128 px before and after,
before_after_v3_128.png.)On the 128 display, the lines move down by 1 to 4 pixels. The selection box moves down by 2 pixels. This is the same change that all other 128 menus got in #453. Now the Obs Lists screen looks the same as the Objects menu on a v3 unit.
Other screens in the observing-list flow
I examined the other screens for fixed 128-pixel positions:
obslists/): this isUIObsListtoo, so this change repairs it.UIObjectList. It already useslist_layout()and is correct on rev4.UIModule.message(). It already calculates its size from the display.I found no other fixed positions. The other
128values in these files are colour brightness values, not positions.One old behaviour does not change: the scrolling text on the selected line uses the full display width for its length, but it starts at the text indent. Thus, the last character can go off the right edge while the text scrolls. This occurs on both displays and it occurred before this change.
Tests
nox -s lint format type_hints smoke_tests unit_tests: all pass (2303 unit tests).🤖 Generated with Claude Code